<template>
    <div>
        <p>留言反馈</p>
        <div class="header">
          <p class="a">留言</p>
          <el-form :model="info">
            <textarea name="" id="" cols="30" rows="10" v-model="info.content" class="tex"></textarea>
        </el-form>
          <span >
            <el-button >取消</el-button>
            <el-button type="primary" @click="addUser">提交</el-button>
          </span>
        </div>
        <div class="rep" >
        <ul>
          <li v-for="(item,index) in list_liuyanban" :key="index" style="" class="li1">
            <div class="use">
              <img :src="item.picture" alt=""> 用户:{{item.username}}
            </div>
            <div class="cont">{{item.content}}</div>
            <div class="repl">回复:{{item.reply}}</div>
          </li>
        </ul>
      </div>  
</div>  
</template>

<script>
export default {
    data() {
        return{
          info:{},
          pageNum: 1,
          pageSize: 3,
          list_liuyanban:[]
        }
        
    },
    methods:{
      async addUser() {
        let { data: res } = await this.$axios.post("/msgboard/add",this.info);
        if (res.code != 200) return this.$message.error(res.message)
        this.$message.success(res.code);

        
      },
      async getLiuyanban(pageSize,pageNum){
          let { data: res } = await this.$axios.get("/msgboard/getlist", {
            params: {
              pageSize,
              pageNum,
            },
          })
          window.console.log(res);
          this.total = res.data.total
          this.list_liuyanban = res.data.list;
      },
    },
    created(){
      this.getLiuyanban()
    }
    
}
</script>

<style lang="scss" scoped>
p{
    text-align: center;
    font-size: 30px;
    font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
}
.header{
  width: 55%;
  height: 300px;
  margin: 30px auto;
  background-color: #ccc;
  border-radius: 5px;
  .a{
    position: absolute;
    margin-left: 30px;
    margin-top: 80px;
    font-size: 12px;
  }
  .tex{
    width: 40%;
    position: absolute;
    margin-top: 40px;
    margin-left: 80px;
  }
  span{
    width: 55%;
    display: flex;
    justify-content: center;
    position: absolute;
    margin-top: 240px;
  }
}
.rep{ 
  width: 55%;
  box-shadow: 10px 10px 5px skyblue;
  border: 2px solid skyblue;
  border-radius: 5px;
  display: flex;
  align-items: center;
  margin: 100px auto;
  .li1{
    width: 80%;
    margin: 0 auto;
    border-bottom: 3px solid skyblue;
  }
  .use{
    width: 900px;
    margin: 0 auto;
    display:flex;
    flex-direction:row;
    align-items:center;  
    img{
    width: 60px;
    height: 60px;
    border-radius: 50%;
    }
  }
  .cont{
    width: 55%;
    padding: 5px;
    border-radius: 5px;
    background-color:skyblue;
    margin:10px auto;
  }
  .repl{
    width: 55%;
    padding: 5px;
    border-radius: 5px;
    background-color:skyblue;
    margin:10px auto;
  }

    
     
  
}
</style>


